/**
** created by zhouzhineng 15-07-01
** 主要用于编译android log记录
**/
var path = require('path'),
	fs = require('fs');

var g_logPath = null;
var g_isInit = false;

module.exports.init = function(logPath) {
	g_logPath = logPath;
	g_isInit = true;
}

module.exports.isInit = function() {
	return g_isInit;
}

module.exports.save = function(errCode,errMsg) {
	if(g_logPath != null && errCode != null & errMsg != null) {
		var logJson = '{' + '"errCode"' + ":" + errCode + "," + '"errMsg"' + ":" + '"'+errMsg+ '"'+'}';
		// var ret = fs.writeFileSync(g_logPath, logJson, {encoding:'utf-8'}); 
		// if(ret < 0) {
		// 	console.err("can not write log message!");
		// }
		fs.writeFile(g_logPath, logJson, function (err) {
 			
		});
	}
}
